# coding: utf8

__all__ = ['QDockableMenuBar', 'QDockableStatusBar']

from qt import *

def QDockableMenuBar(window, area=Qt.TopToolBarArea):
    toolbar = QToolBar(window)
    menubar = QMenuBar(toolbar)
    toolbar.addWidget(menubar)
    window.addToolBar(area, toolbar)
    return menubar

def QDockableStatusBar(window, area=Qt.BottomToolBarArea):
    toolbar = QToolBar(window)
    statusbar = QStatusBar(toolbar)
    toolbar.addWidget(statusbar)
    window.addToolBar(area, toolbar)
    return statusbar
    
class MainWindow(QMainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()
        
        self.menubar = QDockableMenuBar(self)        
        self.menubar.addAction('&File')
        self.menubar.addAction('&View')
        
        self.statusbar = QDockableStatusBar(self)
        self.statusbar.showMessage('idle')

        
def main():
    app = QApplication([])
    wnd = MainWindow()
    wnd.show()
    app.exec_()

if __name__ == '__main__':
    main()
